const app = getApp();
Page({
 
  data: {
    leftList: [],
    rightList: [],
    top:[]
  },
  onLoad() {
    this.getList();
    this.gettop();
  },

  getList() {
    app.get('show/list').then(res => {
      let list = res.data;
      console.log(list);
      // 偶数给左侧列表
      let leftList = list.filter((item, index) => index % 2 === 0);
      // 奇数给右侧列表
      let rightList = list.filter((item, index) => index % 2 !== 0);
      this.setData({
        leftList,
        rightList
      },()=> {
        wx.hideLoading();
      });

    }).catch(err => {
      // todo
    })
  },
  gettop() {
    app.get('show/qiang').then(res => {
      let top = res.data;
      console.log(top);
      // 偶数给左侧列表
      this.setData({
        top
      },()=> {
        wx.hideLoading();
      });

    }).catch(err => {
      // todo
    })
  }
})